package com.goverse.mancraft.man.action;

import android.util.Log;

import com.goverse.mancraft.CommonParams;

/**
 * Created by gaoyu on 2017/4/15.
 */

public class ShopAction extends AbstractAction{
    @Override
    public int getLoseHp() {
        return 0;
    }

    @Override
    public void onStop() {

    }

    @Override
    public void onStart() {

        int money = mMan.getMoney();
        Log.d("ManCraft", mMan.getName() + "-----MONEY-----" + money);

        int hp = mMan.getHp();
        int needHp = 100 - mMan.getHp();
        int needMoney = needHp;
        if (money > needMoney) {

            mMan.addHp(needHp);
            mMan.setMoney(money - needMoney);
        } else if (money < needMoney) {

            mMan.addHp(money);
            mMan.setMoney(0);
        }

        WalkAction walkAction = new WalkAction();
        walkAction.setDestination(CommonParams.MINE);
        doAction(walkAction);
    }
}
